<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
  
Route::get('/', function () {
    return view('welcome');
});
    // 验证码
Route::get('captcha/show', 'CaptchaController@Show');

Route::group(['prefix'=>'admin','namespace'=>'admin','middleware'=>['web']],function(){
    // 登录页面
    Route::get('login',function(){
        return view('admin/user/index');
    }); 
    // 登录验证
    Route::post('login_user','UserController@Login');

});
Route::group(['prefix'=>'home','middleware'=>['web']],function(){
    // 前台页面
    Route::get('index',function(){
        return view('home/index');
    }); 


});
Route::group(['prefix'=>'admin','namespace'=>'admin','middleware'=>['web','admin.login']],function(){

    // 清除登录session
    Route::get('quit','UserController@Quit');

    // 修改密码
    
    Route::get('pass',function(){
        return view('admin/user/pass');
    }); 
    Route::post('newpass','UserController@Pass');


    // 1. 商品类别
    
    // 查看商品类别信息路由
    Route::get('leibie','TeibieController@ShowType');
    // 商品类别删除路由
    Route::delete('leibie/del/{id}', 'TeibieController@TypeDel');
    // 打开商品类别添加路由 
    Route::get('leibie/add', function () {
        return view('admin/leibie/addleibie'); 
    }); 
    // 提交添加商品类别路由
    Route::post('leibie/addshow','TeibieController@TypeAdd');
    // 打开修改商品类别信息路由
    Route::get('leibie/exit/{id}','TeibieController@TypeExit');
    // 修改提交路由
    Route::post('leibie/up','TeibieController@TypeUp');  
    // 删除复选框路由
    Route::post('leibie/delall', 'TeibieController@TypeDelall');


    // 2. 公告

    // 打开公告路由
    Route::get('gonggao','GonggaoController@ShowGonggao');
    // 公告删除路由
    Route::delete('gonggao/del/{id}', 'GonggaoController@GonggaoDel');
    // 打开公告添加路由
    Route::get('gonggao/add', function () {
        return view('admin/gonggao/addgonggao'); 
    });
    // 提交添加公告内容路由
    Route::post('gonggao/addgonggao','GonggaoController@GonggaoAdd');
    // 打开修改公告信息路由
    Route::get('gonggao/exit/{id}','GonggaoController@GonggaoExit');
    // 修改提交路由
    Route::post('gonggao/up','GonggaoController@GonggaoUp'); 
    // 删除复选框路由
    Route::post('gonggao/delall', 'GonggaoController@GonggaoDelall');

    // 3. 商品管理
    // 商品信息路由
    Route::get('shopym','ShopymController@LookShopym');
    // 添加商品路由
    Route::get('shopym/add', function () {
        return view('admin/shopym/addshopym'); 
    });
    // 提交添加商品内容路由
    Route::post('shopym/addshopym','ShopymController@Addym');
    // 打开修改商品信息路由
    Route::get('xgshopym/{id}','ShopymController@Xgshopym');
    // 修改提交路由
    Route::post('xgshopym/up','ShopymController@ShopymUp'); 
    // 删除商品
    Route::delete('delshopym/{id}','ShopymController@Delshopym');
    // 删除复选框路由
    Route::post('shopym/delall', 'ShopymController@Delallym');

     // 4. 订单管理
    // 订单信息路由
    Route::get('dingdan','DingdanController@LookDingdan');
    // 打开修改商品信息路由
    Route::get('xgdingdan/{id}','DingdanController@Xgdingdan');
    // 修改提交路由
    Route::post('xgdingdan/up','DingdanController@DingdanUp'); 
    // 删除商品
    Route::delete('deldingdan/{id}','DingdanController@Deldingdan');
    // 删除复选框路由
    Route::post('dingdan/delall', 'DingdanController@Delalldd');

    // 5. 会员管理
    // 会员信息路由
    Route::any('user','VipController@LookUser');
    // 删除会员
    Route::delete('deluser/{id}','VipController@Deluser');
    // 删除复选框路由
    Route::post('user/delall', 'VipController@Delalluser');


});
